﻿<!DOCTYPE HTML>
<html>

<head>
    <title></title>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/static/h-ui.admin/css/style.css" />
    <!-- <script src="../ckeditor/ckeditor/ckeditor.js"></script> -->
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/base.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/contract_sealManage.css">
    <title>印章管理</title>
</head>

<body>
<include file="header"/>
<include file="aside"/>

    <div class="page-container contract_sealManage Hui-article-box">
        <div class="tit common_tit">
            <div class="left_cont">
                <span>印章管理</span>
                <a class="btn btn-success radius ml-20" onclick="picture_upload()" href="javascript:;">
                    <i class="Hui-iconfont">&#xe600;</i>新增印章
                </a>
            </div>
            <div class="right_cont">
                <input type="text" name="" placeholder="请输入名称" style="width:150px" class="input-text">
                <button name="" class="btn btn-success" type="submit">
                    <i class="Hui-iconfont"></i> 搜索</button>
            </div>
        </div>
        <div class="contrant_manage_table mt-20">
            <table class="table table-border table-bordered table-bg table-hover table-sort auth_table">
                <thead>
                    <tr class="text-c">
                        <th>已有印章</th>
                        <th>印章名</th>
                        <th>操作</th>
                        <th class="del"></th>
                    </tr>
                </thead>

                <if condition="!empty( $data )">
                    <volist name="data" id="list" key="k">

                        <tbody>
                            <tr class="text-c">
                                <td class="img">
                                    <img src="{$list.url}" alt="">
                                </td>
                                <td class="t_name">{$list.name}</td>
                                <td>
                                    <a href="javascript:;" style="text-decoration: none;">
                                        <button data-id="{$list.id}" class="buta rename" onclick="rename(this,'{$list.id}')">
                                            <i class="Hui-iconfont">&#xe6df;</i>重命名
                                        </button>
                                    </a>
                                </td>
                                <td class="del">
                                    <i class="Hui-iconfont delete" onClick="deleteInfos(this,'{$list.id}')">&#xe6a6;</i>
                                </td>
                            </tr>
                        </tbody>

                    </volist>
                    <else/>
                    <tbody>
                    <tr class="text-c">
                        <td colspan="4">暂时无数据</td>
                    </tr>
                    </tbody>
                </if>
            </table>

            <!--<div class="page-wrap dataTables_wrapper">-->

                <!--<div class="dataTables_info" id="DataTables_Table_0_info" role="status" aria-live="polite">显示 1 到 1 ，共 1 条</div>-->
                <!--<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">-->
                    <!--<a class="paginate_button previous disabled" aria-controls="DataTables_Table_0" data-dt-idx="0" tabindex="0" id="DataTables_Table_0_previous">上一页</a>-->
                    <!--<span>-->
                        <!--<a class="paginate_button current" aria-controls="DataTables_Table_0" data-dt-idx="1" tabindex="0">1</a>-->
                    <!--</span>-->
                    <!--<a class="paginate_button next disabled" aria-controls="DataTables_Table_0" data-dt-idx="2" tabindex="0" id="DataTables_Table_0_next">下一页</a>-->
                <!--</div>-->
            <!--</div>-->
            {$page}
        </div>
    </div>

    <div id="renames" class="modal fade auth_control_pop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content radius">
                <div class="modal-header">
                    <h3 class="modal-title">新增印章</h3>
                    <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
                </div>
                <div class="modal-body">
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-3 text-r">重命名：</label>
                        <div class="formControls col-xs-4 col-sm-6">
                            <input type="text" class="input-text radius name" autocomplete="off" name="name" placeholder="输入新名称">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary seal_submit" onclick="sureRename('{$list.id}')">确定</button>
                    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
                </div>
            </div>
        </div>
    </div>


    <script type="text/javascript" src="__PUBLIC__/Admin/lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Admin/lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Admin/static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Admin/static/h-ui.admin/js/H-ui.admin.js"></script>


    <script type="text/javascript" src="__PUBLIC__/Admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/layui/layui.all.js"></script>
    <script type="text/javascript">
        $(function () {});


        /*图片-编辑*/
        function picture_upload( ) {
            // var index = layer.open({
            //     type: 2,
            //     title: title,
            //     content: url
            // });
            // layer.full(index);



            window.location.href='http://'+window.location.host+'/Admin/Admin/sealAddstep1.html';



        }


        /**
         * 重命名弹窗
         */
        function rename(obj,id) {
            var id=id;
            console.log(obj)
            $("#renames").modal("show")
            $('.seal_submit').on('click', function () {
                var newName = $('#renames .name').val();
                $(obj).parents('td').siblings('.t_name').html(newName);
                $("#renames").modal("hide")
            })


        }


        /**
         * 重命名确认
         */
        function sureRename(id) {
            var id=id;
            alert(id);
            alert($('#renames .name').val());

            $.ajax({
                type: "post",
                url: "{:U('Admin/sealReName')}",
                data: {"id": id, "name": $('#renames .name').val()},
                success:function (result) {
                    if ( result == 10 ) {
                        layer.msg('操作成功', {icon: 1});
                        return false;
                    } else {
                        layer.msg('操作失败', {icon: 5});
                        return false;

                    }
                }
            })

        }

        /**
         * 删除
         */
        function deleteInfos(obj,id) {
            var id=id;
            var objParent = $(obj).parents('tr')
            //询问框
            layer.confirm('温馨提示？', {
                btn: ['确定', '取消'], //按钮
                shade: false //显示遮罩
            }, function () {

                $.ajax({
                    type: "post",
                    url: "{:U('Admin/sealDel')}",
                    data: {"id": id},
                    success:function (result) {
                        if ( result == 10 ) {
                            layer.msg('操作成功', {icon: 1});
                            window.location.reload()
                        } else {
                            layer.open({content:'操作失败',time: 2});
                            return false;

                        }
                    }
                })





                objParent.remove()
            }, function () {
                layer.close()
            });






        }
    </script>

</body>

</html>